#pragma once


class CPlayerController
{
private:
	//the pawn mesh and textures
	LPD3DXMESH			m_RobotMesh1;
	LPD3DXMESH			m_RobotMesh2;
	IDirect3DTexture9*	m_Red;
	IDirect3DTexture9*	m_Purple;
	IDirect3DTexture9*	m_Blue;
	IDirect3DTexture9*	m_Yellow;

public:
	void InitController(LPDIRECT3DDEVICE9& D3DDevice)
	{
		D3DXLoadMeshFromX(L"Meshes/RobotMesh1.x", D3DXMESH_MANAGED, D3DDevice,
			NULL, NULL, NULL, NULL, &m_RobotMesh1);

		D3DXLoadMeshFromX(L"Meshes/RobotMesh2.x", D3DXMESH_MANAGED, D3DDevice,
			NULL, NULL, NULL, NULL, &m_RobotMesh2);

		D3DXCreateTextureFromFile( D3DDevice,	//The Direct3D device dereference//
			L"Textures/robotRed.bmp",					//The filename of the texture//
			&m_Red);							//Location we are storing the texture//
		D3DXCreateTextureFromFile( D3DDevice,	//The Direct3D device dereference//
			L"Textures/robotPurple.bmp",					//The filename of the texture//
			&m_Purple);							//Location we are storing the texture//
		D3DXCreateTextureFromFile( D3DDevice,	//The Direct3D device dereference//
			L"Textures/robotBlue.jpg",					//The filename of the texture//
			&m_Blue);							//Location we are storing the texture//
		D3DXCreateTextureFromFile( D3DDevice,	//The Direct3D device dereference//
			L"Textures/robotYellow.jpg",					//The filename of the texture//
			&m_Yellow);							//Location we are storing the texture//
	}

	LPD3DXMESH& getMesh(int player)
	{
		switch(player)
		{
		case P0:
		case P1:
			return m_RobotMesh1;
		case P2:
		case P3:
			return m_RobotMesh2;
		}
		return m_RobotMesh1;
	}

	IDirect3DTexture9* getTexture(int player)
	{
		switch(player)
		{
		case P0:
			return m_Red;
		case P1:
			return m_Purple;
		case P2:
			return m_Blue;
		case P3:
			return m_Yellow;
		}
		return m_Red;
	}

	~CPlayerController()
	{
		ReleaseThis(m_RobotMesh1);
		ReleaseThis(m_RobotMesh2);
		ReleaseThis(m_Red);
		ReleaseThis(m_Purple);
		ReleaseThis(m_Blue);
		ReleaseThis(m_Yellow);
	}
};